#include <stdio.h>

int main()
{
   int n = 0;
   int m = 0;
   
   scanf("%d%d",&n,&m);
   
   int arr1[30] = {0};
   int arr2[30]	= {0};
   int arr3[60] = {0};
   
   int i = 0;
   for(i = 0;i < n;i ++ )
   {
   	scanf("%d",&arr1[i]);
   }
   
   for(i = 0;i < m;i++)
   {
   	scanf("%d",&arr2[i]);
   	
   }

	i = 0;
	int j = 0;
	int k = 0;
	while(i < n&&j < m)
	{
		
		if(arr1[i] < arr2[j])
		{
			arr3[k] = arr1[i];
			
			i++;
			k++; 
		}
		
		else
		{
			
			arr3[k] = arr2[j];
			j ++;
			k ++;
		}
	}
	
	if(i == n)
	{
		for(j = 0;j < m; j++)
		{
			arr3[k] = arr2[j];
			k++;
		}
	}
	
	
	if(j == m)
	{
		for(i = 0; i< n;i++)
		{
			arr3[k] = arr1[i];
			k++;
		}
	}
	
	for(k = 0;k < m;k ++)
	   {
		prinf("%d",arr3[k]);
    	}
	
	
	
	
	return 0;
 } 
